<script setup lang="ts">
import { Subject } from 'rxjs';
import { ctrlState } from './main2-form-state';
import { FormControl, IActionParam, IParam, ControlAction, IContext } from '@core';
interface Props {
  name:string,
  context: IContext;
  viewParams?: IParam;
  controlAction: ControlAction;
  showBusyIndicator?: boolean;
  viewSubject: Subject<IActionParam>;
}

const props = withDefaults(defineProps < Props > (), {
  viewSubject: () => new Subject < IActionParam > (),
  showBusyIndicator: true,
})

// emit声明
interface CtrlEmit {
  (name: "ctrlEvent", value: IActionParam): void;
}

const emit = defineEmits <CtrlEmit> ();

// 安装功能模块，提供状态和能力方法
const { name, state, load, loadDraft, save, remove, refresh, onEditorEvent, onComponentEvent, getData } = new FormControl(ctrlState, props, emit).moduleInstall();

// 暴露内部状态及能力
defineExpose({ name, state, load, loadDraft, save, remove, refresh, getData });
</script>
<template>
  <a-form name="Main2" class="app-form app-info-form" style="" :model="state.data" :rules="state.rules">
<AppFormGroup 
  name="group1"
  title="活动宣传基本信息"
  :visible="state.detailsModel.group1.visible" 
  :layoutOpts="{selfLayout: 'TABLE_24COL',parentLayout: 'TABLE_24COL',colMD: 24,}"
  :infoGroupMode="true"
  :titleBarCloseMode="0"
  :showCaption="false"
  :uIActionGroup="state.detailsModel.group1.uIActionGroup"
  @componentEvent="onComponentEvent">
  <AppFormItem 
    name="ls_law_propagandizename"
    label="标题"
    :labelWidth="130"
    :rules="state.rules.ls_law_propagandizename"
    :required="state.detailsModel.ls_law_propagandizename.required"
    :visible="state.detailsModel.ls_law_propagandizename.visible" 
    :layoutOpts="{parentLayout: 'TABLE_24COL',colMD: 24,}"
  >
    <div class="form-editor-container" style="">
<AppSpan
  name="ls_law_propagandizename"
  :disabled="state.detailsModel.ls_law_propagandizename.disabled"
  dataType="25"
  :value="state.data.ls_law_propagandizename"
  :context="state.context"
  :viewParams="state.viewParams"/>
    </div>
  </AppFormItem>
  <AppFormItem 
    name="draftman"
    label="起草人"
    :labelWidth="130"
    :rules="state.rules.draftman"
    :required="state.detailsModel.draftman.required"
    :visible="state.detailsModel.draftman.visible" 
    :layoutOpts="{parentLayout: 'TABLE_24COL',colLG: 12,colMD: 12,}"
  >
    <div class="form-editor-container" style="">
<AppSpan
  name="draftman"
  :disabled="state.detailsModel.draftman.disabled"
  dataType="25"
  :value="state.data.draftman"
  :context="state.context"
  :viewParams="state.viewParams"/>
    </div>
  </AppFormItem>
  <AppFormItem 
    name="deptname"
    label="起草部门"
    :labelWidth="130"
    :rules="state.rules.deptname"
    :required="state.detailsModel.deptname.required"
    :visible="state.detailsModel.deptname.visible" 
    :layoutOpts="{parentLayout: 'TABLE_24COL',colLG: 12,colMD: 12,}"
  >
    <div class="form-editor-container" style="">
<AppSpan
  name="deptname"
  :disabled="state.detailsModel.deptname.disabled"
  dataType="25"
  :value="state.data.deptname"
  :context="state.context"
  :viewParams="state.viewParams"/>
    </div>
  </AppFormItem>
  <AppFormItem 
    name="draftdate"
    label="起草时间"
    :labelWidth="130"
    :rules="state.rules.draftdate"
    :required="state.detailsModel.draftdate.required"
    :visible="state.detailsModel.draftdate.visible" 
    :layoutOpts="{parentLayout: 'TABLE_24COL',colLG: 12,colMD: 12,}"
  >
    <div class="form-editor-container" style="">
<AppSpan
  name="draftdate"
  :disabled="state.detailsModel.draftdate.disabled"
  dataType="5"
  valueFormat="YYYY-MM-DD HH:mm:ss"
  :value="state.data.draftdate"
  :context="state.context"
  :viewParams="state.viewParams"/>
    </div>
  </AppFormItem>
  <AppFormItem 
    name="createmantelnum"
    label="联系电话"
    :labelWidth="130"
    :rules="state.rules.createmantelnum"
    :required="state.detailsModel.createmantelnum.required"
    :visible="state.detailsModel.createmantelnum.visible" 
    :layoutOpts="{parentLayout: 'TABLE_24COL',colLG: 12,colMD: 12,}"
  >
    <div class="form-editor-container" style="">
<AppSpan
  name="createmantelnum"
  :disabled="state.detailsModel.createmantelnum.disabled"
  dataType="25"
  :value="state.data.createmantelnum"
  :context="state.context"
  :viewParams="state.viewParams"/>
    </div>
  </AppFormItem>
  <AppFormItem 
    name="num"
    label="单号"
    :labelWidth="130"
    :rules="state.rules.num"
    :required="state.detailsModel.num.required"
    :visible="state.detailsModel.num.visible" 
    :layoutOpts="{parentLayout: 'TABLE_24COL',colMD: 24,}"
  >
    <div class="form-editor-container" style="">
<AppSpan
  name="num"
  :disabled="state.detailsModel.num.disabled"
  dataType="25"
  :value="state.data.num"
  :context="state.context"
  :viewParams="state.viewParams"/>
    </div>
  </AppFormItem>
  <AppFormItem 
    name="memo"
    label="内容"
    :labelWidth="130"
    :rules="state.rules.memo"
    :required="state.detailsModel.memo.required"
    :visible="state.detailsModel.memo.visible" 
    :layoutOpts="{parentLayout: 'TABLE_24COL',colMD: 24,}"
  >
    <div class="form-editor-container" style="">
<AppSpan
  name="memo"
  :disabled="state.detailsModel.memo.disabled"
  dataType="21"
  :value="state.data.memo"
  :context="state.context"
  :viewParams="state.viewParams"/>
    </div>
  </AppFormItem>
</AppFormGroup>
<AppFormGroup 
  name="grouppanel1"
  title="审批意见"
  :visible="state.detailsModel.grouppanel1.visible" 
  :layoutOpts="{selfLayout: 'TABLE_24COL',parentLayout: 'TABLE_24COL',colMD: 24,}"
  :infoGroupMode="true"
  :titleBarCloseMode="0"
  :showCaption="true"
  :uIActionGroup="state.detailsModel.grouppanel1.uIActionGroup"
  @componentEvent="onComponentEvent">
  <AppFormItem 
    name="yj"
    label="法务组组长意见"
    :labelWidth="130"
    :rules="state.rules.yj"
    :required="state.detailsModel.yj.required"
    :visible="state.detailsModel.yj.visible" 
    :layoutOpts="{parentLayout: 'TABLE_24COL',colMD: 24,}"
  >
    <div class="form-editor-container" style="">
<AppInput
  name="yj"
  :disabled="state.detailsModel.yj.disabled"
  :showMaxLength="true"
  type="textarea"
  :value="state.data.yj"
  @editorEvent="onEditorEvent"
/> 
    </div>
  </AppFormItem>
</AppFormGroup>
  </a-form>
</template>
<style lang="scss">
  .app-form {
    .ant-card-head {
      padding: 0;
      margin: 0 10px;
    }
  }
</style>